<?php
	require 'connect.php';
	session_start();
	$_SESSION['loginid'] = 'jg';
	if (isset($_SESSION['loginid'])){
		$sql = "select top 30 item.item_id as ItemID,item.draw_id as Blueprint,
						item.item_name as ItemName,Convert(decimal(18,2),item.Price) as Price,
						item.default_supply_id as SupplyID,supply.supply_name as SupplyName
					from item 
					left outer join supply on item.default_supply_id = supply.supply_id
					order by item.madedate desc";
				
		$rs = odbc_exec($conn,$sql);
		$billInfo=array();
		$i=0; 
		while($row=odbc_fetch_array($rs))
		{
			$row["Blueprint"] = iconv("GBK","UTF-8",$row["Blueprint"]);
			$row["ItemName"] = iconv("GBK","UTF-8",$row["ItemName"]);
			$row["SupplyName"] = iconv("GBK","UTF-8",$row["SupplyName"]);
			$billInfo[$i]=$row; 
	       	$i++;  
		}
		odbc_close($conn);
		echo $_GET['jsoncallback']."(".json_encode($billInfo).")";
	}
				
?>